package n2106;

import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	
	
	static int getPri(char m)
	{
		if(m=='!')return 2;
		if(m=='|')return 0;
		if(m=='&')return 1;
		else return -1;
	}
	
	/**
	 * 中缀转后缀，求值
	 */

	static boolean solve(String input)
	{
		
		char suffix[]=new char[102];
		char op[]=new char[102];
		int top=-1;
		int k=0;
		op[++top]='#';
		for(int i=0;i<input.length();i++)
		{
			char s=input.charAt(i);
			if(s==' ')
			{
				continue;
			}
			if(s=='F'||s=='V')
			{
				suffix[k++]=s;
			}else if(s=='('){
				op[++top]=s;
			}
			else if(s==')')
			{
				while(top>-1&&op[top]!='(')
				{
					suffix[k++]=op[top];
					top--;
				}
				top--;//遇到左括号，继续减1
			}else if(getPri(s)>getPri(op[top]))
			{
				op[++top]=s;
			}else if(getPri(s)<=getPri(op[top]))
			{
				while(getPri(s)<getPri((op[top])))
				{
					suffix[k++]=op[top];
					top--;
				}
				op[++top]=s;
			}
		}
		
		while(top>0)
		{
			suffix[k++]=op[top];
			top--;
		}
		
		//System.out.println(String.valueOf(suffix,0,k));
		
		boolean result[]=new boolean[102];
		
		top=0;
		
		for(int i=0;i<k;i++)
		{
			if(suffix[i]=='V')
			{
			   result[top++]=true;	
			}else if(suffix[i]=='F')
			{
				result[top++]=false;
			}else if(suffix[i]=='!')
			{
				result[top-1]=!result[top-1];
			}else if(suffix[i]=='|')
			{
				result[top-2]=result[top-2]||result[top-1];
				top--;
			}else if(suffix[i]=='&')
			{
				result[top-2]=result[top-2]&&result[top-1];
				top--;
			}
		}
		return result[0];
	}
	/**
	 * @param args
	 */
	public static void main(String[] args) throws Exception{

		BufferedReader bf=new BufferedReader(new InputStreamReader(System.in));
		String line=null;
		int t=1;
		while((line=bf.readLine())!=null)
		{
			if(solve(line))
			{
				System.out.println("Expression "+t+": V");
			}else{
				System.out.println("Expression "+t+": F");
			}
			t++;
		}
	}

}
